# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo12
# Description:
# Author:       98745
# Date:         2019/4/2
#-------------------------------------------------------------------------------
from sqlalchemy import Column, String, create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
engine = create_engine('mysql+pymysql://root:root@localhost:3306/xuexi?charset=utf-8', echo=True)
DBSession = sessionmaker(bind=engine)
session = DBSession()

query=session.execute('select * from xs')
query=query.fetchall()#获取所有的结果fetchone()取得结果的第一行
print(query)
session.close()#关闭连接